#!/bin/bash
#


read -p "进程名称: " process


if ! ps -elf | grep "$process" | grep -v "grep" &> /dev/null; then
   echo "进程${process}没有启动"
else
   proc_id=$(pidof $process)
   port=$(netstat -tunlp | grep "$process" | awk '{print $4}' | awk -F: '{print $4}')
   start_time=$(ps -p $proc_id -o lstart=)
   echo "启动时间: $start_time  进程名称: $process   进程ID: $proc_id   端口: $port"
fi
